﻿using System;
using System.Collections.Generic;
using System.Text;
using DAL=IrisGenerator.Dal;
using System.Data;

namespace IrisGenerator.Common.DatabaseModel.DataAccess
{
    public class ConstraintKey:IDisposable
    {
        private DAL.DataAccess _dataAccess;

        public ConstraintKey()
        {
            this._dataAccess = new DAL.DataAccess();
        }

        public virtual System.Nullable<System.Guid> ConstraintKey_Insert(Guid? ConstraintId,Guid? PrimaryId,Guid? ForeignId)
        {
            this._dataAccess.CreateProcedureCommand("ConstraintKey_Insert");
            this._dataAccess.AddParameter("conId", ConstraintId, ParameterDirection.Input);
            this._dataAccess.AddParameter("priId", PrimaryId, ParameterDirection.Input);
            this._dataAccess.AddParameter("forId", ForeignId, ParameterDirection.Input);
            Guid value = ((Guid)(this._dataAccess.ExecuteScalar()));
            return value;
        }

        public virtual DataSet GetConstraintKeys(Guid? ConstraintId)
        {
            this._dataAccess.CreateProcedureCommand("ConstraintKeys_SelectBy_Constraint");
            this._dataAccess.AddParameter("ConstraintId", ConstraintId, ParameterDirection.Input);
            return this._dataAccess.ExecuteDataSet();
            
        }

        public virtual void Dispose()
        {
            if ((this._dataAccess != null))
            {
                this._dataAccess.Dispose();
            }
        }
    }
}
